;!function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(global) :
typeof define === 'function' && define.amd ?  define(function() { return factory(global) }) :
(global.mediaDevices = factory(global));
}(this, (function (win) {

	var mediaDevices=function(pram)
	{
	  
		var _self=this;
		_self.version = "1.0.0(2018-11-13)";//版本
		
		if ( win.navigator.mediaDevices && win.navigator.mediaDevices.getUserMedia )	
			{
				
				win.navigator.mediaDevices.getUserMedia(pram.constraints).then(function(stream){
					pram.successfun(stream);//成功后执行
				}).catch(function(error){
				  //console.log("访问用户媒体设备失败");//
				  //console.log(error);//
				  pram.errorfun({result:0,msg:"访问用户媒体设备失败"});
				});			
			}
			else
			{
				pram.errorfun({result:-1,msg:"不支持访问用户媒体媒体设备,请更换浏览器"});
			}
			
	};
	return mediaDevices;

}));